-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend demo bnd-workspace for creation of executable jar via .bndrun #4675
base: main
Are you sure you want to change the base?
Extend demo bnd-workspace for creation of executable jar via .bndrun #4675
Conversation
ddf14cf
to
8c74a50
Compare
- added a .bndrun in the demo.impl bundle which is used to build the executable jar (comparable to building the product) - added another consumer bundle which - installed Felix Gogo Shell, so that you can even start the application and type 'hello' in the console to get an output from the service. this is basically now a very simple OSGi application - changed to Java17 - removed all warnings in Eclipse tweak target-dir with ${driver} this allows to use different build tools independently
8c74a50
to
0ccd052
Compare
Test Results 606 files ±0 606 suites ±0 4h 0m 52s ⏱️ + 5m 42s For more details on these failures, see this check. Results for commit 0ccd052. ± Comparison against base commit 9330061. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the upcomming support you need to add
-Dbndrun.exports=tycho.demo.app
to the maven.config
file.
Also we should not check in the .project
/.classpath
files as this is a headless demo.
It would also be good the enhance this testcase:
tycho/tycho-its/src/test/java/org/eclipse/tycho/test/DemoTest.java
Lines 79 to 82 in 9330061
public void testTychoBndWorkspaceDemo() throws Exception { | |
runDemo("bnd-workspace"); | |
} | |
to assert that the output file (will be target/tycho.demo.app.zip
in this case) is actually produced, this should fail for now and should succeed after we have added support for this.
@@ -1,3 +1,7 @@ | |||
Bundle-Version: 1.0.0-SNAPSHOT | |||
-runfw: org.eclipse.osgi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this I get
Exception in thread "main" java.lang.NoClassDefFoundError: org/osgi/framework/ServiceListener
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:714)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
at aQute.launcher.pre.EmbeddedLauncher.executeWithRunPath(EmbeddedLauncher.java:160)
at aQute.launcher.pre.EmbeddedLauncher.findAndExecute(EmbeddedLauncher.java:118)
at aQute.launcher.pre.EmbeddedLauncher.main(EmbeddedLauncher.java:51)
Caused by: java.lang.ClassNotFoundException: org.osgi.framework.ServiceListener
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
when launching the produced export.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I thought this belongs to .bndrun
, as it it about "running" I thought. And I could have e.g. different .bndrun files using different frameworks (felix, equinox).
I found this sentence
...This means the bnd.bnd file must have the necessary -runfw and -runbundles to support the test bundles built by the project. The check task depends on the testOSGi task.
in
https://github.com/bndtools/bnd/blob/master/gradle-plugins/README.md
and an issue created by you: bndtools/bnd#5504
Is this related?
I can put it back of course, if it is needed.
I try to reproduce it locally and maybe compare what bnd CLI is doing with / without it.
ok, but then it gets hard to extend it. Without Eclipse I would not have been able to develop it... e.g. I need to resolve button to resolve the I guess this is the "thinking" behind the current bnd-maven plugins to be able to develop completely headless. Ideally this would allow a development workflow independent of Eclipse IDE and also use VSCode or whatever. |
In Eclipse you can start the .bndrun and also Export it as an executable jar like this:
The .bndrun can also be created and run for test and comparison purposes via the bnd command line:
or just run it as a application:
bnd run tycho.demo.impl/tycho.demo.app.bndrun
which starts the app and shows the Felix Gogo Shell.
Then type 'hello'.